package com.rq.download_okhttp;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class InstallBroadcast extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("InstallBroadcast", "13:" + intent.getAction());
        if (Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) {
            Toast.makeText(context, "有应用被添加", Toast.LENGTH_LONG).show();
            Log.e("InstallBroadcast", "14:");
        } else if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
            Toast.makeText(context, "有应用被删除", Toast.LENGTH_LONG).show();
            Log.e("InstallBroadcast", "17:");
        } else if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) {
            Toast.makeText(context, "有应用被替换", Toast.LENGTH_LONG).show();
            Log.e("InstallBroadcast", "20:");
        }
    }

}